/*****************************************************
** Author: 
** Date: 2019-11-04
*
*****************************************************/

#include "pwm.h"

/**
 * @brief
 * @param  None
 * @retval None
 */
static int pwm_set(lua_State* L)
{
    int duty = luaL_checkinteger(L, -3);
    int freq = luaL_checkinteger(L, -2);
    int id   = luaL_checkinteger(L, -1);

    lua_log_dbg("set id %d freq %d duty %d", id, freq, duty);
    print_lua_stack(L, "pwm_set");
    return 0;
}

int luaopen_pwm(lua_State *l)
{
    const char *lib_name = "pwm";
    luaL_Reg pwm[] = {
        {"set",     pwm_set},
        {NULL, NULL}
    };
    luaL_openlib(l, lib_name, pwm, 0);
    print_lua_stack(l, "open lua 'pwm'");

    lua_log_inf("open lua 'pwm' success");
    return LUA_ARCH_OK;
}

int luaclose_pwm(lua_State *l)
{
    lua_log_inf("close lua 'pwm'");
    return LUA_ARCH_OK;
}

/* End of file */



